package com.zaofan.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.zaofan.bean.SmsLog;
import com.zaofan.dao.SmsLogDao;

public class SmsLogService {

	private SmsLogDao smsLogDao = new SmsLogDao();

	public void delete(SmsLog smsLog) {
		smsLogDao.del(smsLog);
	}

	public void add(SmsLog smsLog) {
		smsLogDao.add(smsLog);
	}

	public void update(SmsLog smsLog) {
		smsLogDao.update(smsLog);
	}

	public List<SmsLog> findAll(Map<String, Object> params) {
		List<SmsLog> data = smsLogDao.findAll(params);
		if (data == null) {
			data = new ArrayList<>();
		}
		return data;
	}

	public Long count(Map<String, Object> params) {
		return smsLogDao.count(params);
	}

	public SmsLog findById(Integer id) {
		Map<String, Object> params = new HashMap<>();
		params.put("id", id);
		return smsLogDao.findOne(params);
	}

	public List<SmsLog> findTodayLogs(String mobile) {
		List<SmsLog> data = smsLogDao.findTodayLogs(mobile);
		if (data == null) {
			data = new ArrayList<>();
		}
		return data;
	}

	public Long CountTodayLogs(String mobile) {
		return smsLogDao.CountTodayLogs(mobile);
	}

}
